vulkan: Don't wait until graphics are done computing
authorBenjamin Otte <otte@redhat.com>
Thu, 8 Dec 2016 18:56:56 +0000 (19:56 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 9 Dec 2016 17:35:51 +0000 (18:35 +0100)
We can let the GPU do its stuff without waiting. The GPU knows what it's
doing.

Which means we now get a lot of time to spend on doing CPU things (read:
we're way better in benchmarks).

The old behavior is safer, so we want to keep it around for debugging.
It can be reenabled with GSK_RENDERING_MODE=sync.

gsk/gskdebug.c
gsk/gskdebugprivate.h
gsk/gskvulkanrender.c

index bf82b892c80d8f205badf7c55ee5f8fb6725fca0..02ed8b8de06d1a1d92755db026b11e9dc6653efc 100644 (file)
@@ -16,6 +16,8 @@ static const GDebugKey gsk_debug_keys[] = {
 static const GDebugKey gsk_rendering_keys[] = {
   { "geometry", GSK_RENDERING_MODE_GEOMETRY },
   { "shaders", GSK_RENDERING_MODE_SHADERS },
+  { "sync", GSK_RENDERING_MODE_SYNC },
+  { "staging-image", GSK_RENDERING_MODE_STAGING_IMAGE },
 };
 
 gboolean
index 29e529beed2466890fd3090c1146088c00d570e9..a5d4784fe9e4cd6ef3322c3a3571dfcb19c92f80 100644 (file)
@@ -17,8 +17,10 @@ typedef enum {
 } GskDebugFlags;
 
 typedef enum {
-  GSK_RENDERING_MODE_GEOMETRY = 1 << 0,
-  GSK_RENDERING_MODE_SHADERS  = 1 << 1
+  GSK_RENDERING_MODE_GEOMETRY      = 1 << 0,
+  GSK_RENDERING_MODE_SHADERS       = 1 << 1,
+  GSK_RENDERING_MODE_SYNC          = 1 << 2,
+  GSK_RENDERING_MODE_STAGING_IMAGE = 1 << 3
 } GskRenderingMode;
 
 gboolean gsk_check_debug_flags (GskDebugFlags flags);
index b645dc33970fa711106fb24db9b9f2be10bd74a5..640c321db8e73144ad42ada61759ca66ae60040e 100644 (file)
@@ -272,11 +272,14 @@ gsk_vulkan_render_submit (GskVulkanRender *self)
                                },
                                self->fence);
 
-  GSK_VK_CHECK (vkWaitForFences, gdk_vulkan_context_get_device (self->vulkan),
-                                 1,
-                                 &self->fence,
-                                 VK_TRUE,
-                                 INT64_MAX);
+  if (GSK_RENDER_MODE_CHECK (SYNC))
+    {
+      GSK_VK_CHECK (vkWaitForFences, gdk_vulkan_context_get_device (self->vulkan),
+                                     1,
+                                     &self->fence,
+                                     VK_TRUE,
+                                     INT64_MAX);
+    }
 }
 
 static void